home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Media 22
/
PC MEDIA CD22.iso
/
share
/
udos
/
disp186a
/
doc
/
ati_16m.doc
next >
Wrap
Text File
|
1994-03-31
|
8KB
|
195 lines
ATI_16M.GRN
Driver for DJGPP with LIBGRX
Version 0.31 (C) 1994 Bernhard Schwall
This is a driver for the ATI Graphics Ultra Plus/Pro to use with the GNU
DJGPP compiler for DOS. To use it set your GO32 environment variable to
ATI_16M.GRN, e.g.
SET GO32=ansi nodpmi d:\djgpp\drivers\ati_16m.grn gw 800 gh 600 nc 256
There are now two compiled versions of the driver included:
ati_16m.grn for use with your own program
ati_16md.grn for use with disp180
(For differences see below)
MODES:
------
The following graphicmodes are supported by the driver:
X-Res Y-Res number of colors color setting for Initialisation
320 200 16 16
640 200 16 16
640 350 16 16
640 480 16 16
800 600 16 16
1024 768 16 16
320 200 256 256
640 400 256 256
640 480 256 256
800 600 256 256
1024 768 256 256
640 480 32768 32768
800 600 32768 32768
1024 768 32768 32768
640 480 65536 0xc000+16 (=49168)
800 600 65536 0xc000+16 (=49168)
1024 768 65536 0xc000+16 (=49168)
640 480 16.7 mio. 0xc000+24 (=49176)
800 600 16.7 mio. 0xc000+24 (=49176)
The last three modes are only supported by cards with 2 MB-Ram (I think).
Because I don't use any routine of the LIBGRX graphics-library exept the
switching to text and graphics-mode I don't know if any routine of this
package will run with the high- and truecolor modes. But you can access the
video-memory direct. The 16 and 256 color modes work as with the normal
ATI.GRD driver.
MEMORY-ALIGNMENT:
-----------------
The memory is mapped to two different places in the virtual memory-space. If
you can use memory-aperutre you can access the memory directly at the mapping-
address. This address can be set direct in the driver (see below). E.g. if
you have set the aperture to MB 9 you can access the memory at address
0xe0900000
The other way to access the memory is to use the swapping-mechanism of the
LIBGRX grapfics library (or GO32). You have to use a GO32 version 1.11 or
above (tested only with 1.11.maint3). There the memory is mapped to 0xd1000000
for read and write.
So just set a 'char' pointer to this address and access the memory direct.
(see below)
If you use a mode which requires only 1MB you can also use the 'old' memory-
window at 0xd0000000. This will run with GO32 version 1.10a and above (tested
with 1.10a and vmpeg)
In modes with 15 or 16 bit (32768 and 65536 colors) each line is twice the
horizontal resolution in byte (e.g. for 640x480: 1280 byte). Two byte
represent the color-tripple as followd:
15 bit: -rrrrrgggggbbbbb bit 0-4 blue, 5-9 green, 10-14 red, 15 unused
16 bit: rrrrrggggggbbbbb bit 0-4 blue, 5-10 green, 11-15 red
In truecolor-modes each line is 3 times the horizontal resolution (e.g. for
800x600: 2400 byte/line).
The colors are represented by 3 bytes in BGR-order. So if you write to memory
first write the blue, then the green and at last the red value to the memory.
(see example)
PROGRAMMING:
------------
To switch to the graphics-mode use the command
GrSetMode(GR_width_height_color_graphics,800,600,0xc000+24);
Set the last three parameters to the values you wish (see table above for
parameters).
To switch back to the textmode use the command
GrSetMode(GR_default_text);
If your program crashes while a high- or truecolor-mode is set you must reset
your computer because the DOS-command 'mode co80' can't set the card back to
the VGA mode.
Because LIBGRX was designed to run with a maximum of 32768 colors (15 bit)
you can't pass the values for 16 and 24 bit via the GO32 setting. For
switching into 16 or 24 bit modes you must set the values directly into the
GrSetMode(...) command.
Here is a short example how to access the video memory:
#include <grx.h>
void main(){
char *memory;
long x,y;
/* switch to mode 800x600x16.7mio */
GrSetMode(GR_width_height_color_graphics,800,600,0xc000+24);
for (y=0; y<600; y++){
memory = (char *)0xd1000000+(3l*800l*y);
/*
if you can use memory-aperture use: (here for aperture at MB 9)
memory = (char *)0xe0900000+(3l*800l*y);
*/
for (x=0; x<800; x++){
*memory++ = y % 256; /* blue */
*memory++ = x % 256; /* green */
*memory++ = (x+y) % 256; /* red */
}
}
GrSetMode(GR_default_text);
}
CONFIGURING THE DRIVER:
-----------------------
There is only one point you can change in the driver. This is the address for
the memory-aperture. In line 263 you can enable or disable the aperture by
setting AL to 0x02 (enable) or 0x00 (disable). If you enable it you can set
the address in line 265 in AH (from 0-127, on ISA only 0-12). I don't know
what will happen if you set the address into your normal RAM and access it
via 0xd1000000. But I'm shure if you try to access your videomemory through
e.g. 0xe0100000 your system will crash.
The default settings are:
memory-aperture disabled but set to address MB 9 as example so you can use it
with all boards.
After changing the values you must recompile the driver with TASM (or MASM,
I think), then link it and make it an obj, e.g.
TASM ATI_16M.ASM
TLINK (ignore the warning 'NO STACK')
EXE2BIN ATI_16M.EXE ATI_16M.GRN
Now the driver should run on your system.
The driver is configured to be used with your own program. If you want to use
it with other programs written for 16 or 24 bit modes perhaps you have to
change the driver, 15 bit modes should run with the standard settings.
E.g. if you want to use the driver with disp180 with 16 or 24 bit modes you
must comment out line 275 and compile the driver. But this drivers wouln't run
with your programs (with LIBGRX 1.03) in 16 and 24 bit modes. If you try to
switch in those modes you will get the error-message 'bad color plane # in
driver' and the program will stop immediately.
The reason for this problem is that LIBGRX was designed for a maximum of 15
colorplanes and it will reject all modes with more than 15 planes. For disp180
LIBGRX was changed (I think) to accept this modes and it uses the # of planes
value returned by the driver to validate the correctness of the videomode.
So you have to support two driver if you want to use disp180 with truecolor
and also want to write your own programs for the drivers.
Another possibility is to change the sourcecode of LIBGRX to support 16 and
24 bit modes. For LIBGRX 1.03 you have to change the file 'setmode.c' and
porhaps some other files to make the driver run with it. Caution: if you do so
notice that the file 'grdriver.inc' shipped with LIBGRX is different to the
file used by disp180 (and by the driver).
ABOUT THE DRIVER:
-----------------
The driver is released without any warranty. It was originally made only for
my own use but I thought it would be usefull for others too. Feel free to send
your comments, hints, changes or reports about this driver. If you have any
problem or question please contact me so I will try to help you.
The driver was tested with disp180 and seems to work in all resolutions.
With a patch it will also work with vmpeg 1.1 but then it will no longer run
with disp180 because vmpeg expects the number of byte per line as horizontal
resolution.
Because 24 bit display with vmpeg is slower then 8 bit display I removed the
patch so you can use the driver with disp180.
Caution: because the programming of 15, 16 and 24 bit modes seems not to be
standardized you should always use the go32 version shipped with the program
you want to use.
AUTHOR:
-------
Bernhard Schwall
Broichstr.56
D-53227 Bonn
e-mail: schwall@athene.informatik.uni-bonn.de